#pragma once
#include "UIBase.h"
#include "GWnd.h"
class GDialog : public GUIBase
{
public:
	GDialog(void);
	void	SendMsg(UINT uMsg, int wParem, int lParam);
	virtual void LoadResAttritute(map<tstring, tstring>& mapAtt);
	virtual DWORD SetSubWnd()=0;
	void LoadResource(const TiXmlElement* DlgElement);
	static void RegisterWndClass();
	void DrawSubWnd();
	void Draw();
	void MoveWindow(int x, int y);
	void SetWindowPos(int left, int botton, int right, int top);
	BOOL IsActivated();
	BOOL IsEnableMove();
	void SetActivated(BOOL bActivated = TRUE);
	GWnd* GetWnd(DWORD hwnd);

	bool IsPointInDialog(int x, int y);
	void MouseMove(int x, int y,int wParam=0);
	void MouseClick(int button, int state, int x, int y);
	void SubWndMouseMove(int x, int y, int wParam=0);
	void SubWndMouseClick(int button, int state, int x, int y);	
	void DestroyAllWnd();
	~GDialog(void);
protected:
	BOOL		m_bEnableMove;
	map<DWORD,GWnd*> m_mapWnd;
private:	
	int			m_nLeft, m_nTop;
	int			m_nRight, m_nBotton;
	int			nCursorPosX, nCursorPosY;
	int			m_nMouseState[3];
	int			m_nPreCursorX, m_nPreCursorY;
	GLuint		m_texture;
	GFont		m_font;
	BOOL		m_bActivated;
};
